package com.ecommerce.order.dto;

import com.ecommerce.order.entity.Order;
import com.ecommerce.order.entity.OrderItem;
import java.util.List;

public class OrderInfo extends OrderResponse {
    public static OrderInfo fromOrder(Order order, List<OrderItem> items) {
        OrderResponse response = OrderResponse.fromOrder(order, items);
        OrderInfo info = new OrderInfo();
        
        // 复制所有属性
        info.setId(response.getId());
        info.setOrderNo(response.getOrderNo());
        info.setUserId(response.getUserId());
        info.setStatus(response.getStatus());
        info.setStatusDesc(response.getStatusDesc());
        info.setTotalAmount(response.getTotalAmount());
        info.setPayAmount(response.getPayAmount());
        info.setDiscountAmount(response.getDiscountAmount());
        info.setShippingFee(response.getShippingFee());
        info.setReceiverName(response.getReceiverName());
        info.setReceiverPhone(response.getReceiverPhone());
        info.setReceiverAddress(response.getReceiverAddress());
        info.setRemark(response.getRemark());
        info.setPayTime(response.getPayTime());
        info.setShipTime(response.getShipTime());
        info.setFinishTime(response.getFinishTime());
        info.setCancelTime(response.getCancelTime());
        info.setCreateTime(response.getCreateTime());
        info.setItems(response.getItems());
        
        return info;
    }
}